New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@unified-latex/unified-latex-util-pgfkeys

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unified-latex/unified-latex-util-pgfkeys

Functions for manipulating pgfkeys-like arguments in a unified-latex AST

  • 1.8.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
528
decreased by-68.31%
Maintainers
0
Weekly downloads
 
Created
Source

unified-latex-util-pgfkeys

What is this?

Functions to help manipulate unified-latex Abstract Syntax Tree (AST) that contain pgfkeys-style arguments. Note that pgfkeys aren't built into Ast.Ast. Instead, parsing nodes as pgfkeys will produce a new (incompatible) AST.

When should I use this?

If you want to parse or manipulate macros/environments with pgfkeys-style arguments.

Install

npm install @unified-latex/unified-latex-util-pgfkeys

This package contains both esm and commonjs exports. To explicitly access the esm export, import the .js file. To explicitly access the commonjs export, import the .cjs file.

Functions

createMatchers()

function createMatchers(): { isChar: (node: Ast.Node, char: string) => node is Ast.String; isComma: (node: Ast.Node) => node is Ast.String; isEquals: (node: Ast.Node) => node is Ast.String; isWhitespace: (node: Ast.Node) => node is Ast.Whitespace; isParbreak: (node: Ast.Node) => node is Ast.Parbreak; isSameLineComment: (node: Ast.Node) => boo...

parsePgfkeys(ast, options)

Parse the arguments of a Pgfkeys macro. The ast is expected to be a comma separated list of Items. Each item can have 0 or more item parts, which are separated by "=". If itemPart is undefined,

If options.allowParenGroups === true, then commas that occur inside groups of parenthesis will not be parsed as separators. This is useful for parsing tikz \foreach loops.

function parsePgfkeys(
  ast: Ast.Node[],
  options: { allowParenGroups: boolean }
): Item[];

Parameters

ParamType
astAst.Node[]
optionsOmitted

pgfkeysArgToObject(arg)

Parse arg as pgfkeys and return a JavaScript object with the results. The keys will be normalized to strings and the values will be arrays of nodes.

function pgfkeysArgToObject(
  arg: Ast.Node[] | Ast.Argument
): Record<string, Ast.Node[]>;

Parameters

ParamType
argAst.Node[] | Ast.Argument

Types

Item

export type Item = {
    itemParts?: Ast.Node[][];
    trailingComment: Ast.Comment | null;
    trailingComma?: boolean;
    leadingParbreak?: boolean;
};

Keywords

FAQs

Package last updated on 21 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc